<%@ page import="java.io.*" %>

<%! // code from roseindia.net
    private byte[] getImage(String filename) {
        byte[] result = null;
        String fileLocation = filename;
        File f = new File(fileLocation);
        result = new byte[(int) f.length()];
        try {
            FileInputStream in = new FileInputStream(fileLocation);
            in.read(result);
        } catch (Exception ex) {
            System.out.println("GET IMAGE PROBLEM :: " + ex);
            ex.printStackTrace();
        }
        return result;
    }
%>

<% //code from roseindia.net
    String filePath = "recgraph" + session.getAttribute("playerID").toString() + ".png";
    
    response.reset();
    response.setHeader("Content-Disposition", "inline");
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Expires", "0");
    response.setContentType("image/jpg");
    
    byte[] image = getImage("H:/code/Outsourced_Partial_Recommend/web/" + filePath);
    OutputStream outputStream = response.getOutputStream();
    outputStream.write(image);
    outputStream.close();
    
  
%>  